﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using JTicket.DAL;
using JTicket.BLL;

namespace JTicket.UI
{
    public partial class JT_OrderManager : RoleBase
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
            }
        }

        protected void BtnSelect_Click1(object sender, EventArgs e)
        {
            Bind();
        }
        protected void dg1_ItemDataBound(object sender, DataGridItemEventArgs e)
        {
            if (e.Item.ItemIndex == -1) return;
            e.Item.Attributes.Add("bgcolor", "#EFFFDA");
            e.Item.Attributes.Add("style", "cursor:hand");
            e.Item.Attributes.Add("onMouseOver=this.style.backgroundColor", "#DBE3FA");
            e.Item.Attributes.Add("onMouseOut=this.style.backgroundColor", "#F6F6F6");

        }
        void Bind()
        {
            Model.D_OperInfo oper= bllOper.Oper();
            string thcode="";
            string cu=oper.CurLevel.ToString();
            if(cu!="3")
            {
           thcode=oper.ThCode;
            }

            DataSet ds = DAL.H_TicketBal.OrderInfoManager
                (this.TextBox1.Text, this.RadioButtonList1.SelectedItem.Value, thcode);
            this.dg1.DataSource = ds.Tables[0].DefaultView;
            this.dg1.DataBind();
         
        }
        public string Gstate(string st)
        {
            switch (st)
            {
                case "1":
                    return "预订";

                default:
                    return "未知状态";
            }
        }
    }
}